package com.wu.base;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author wuyanshen
 * @date 2019-01-23 11:06 AM
 * @discription 基础业务类
 */
@Service
public abstract class BaseService<D extends BaseDao<T>, T extends BaseEntity<T>> {

    @Autowired
    protected D dao;

    public void insert(T entity) {
        //手动调用生成id
        entity.preInsert();
        dao.insert(entity);
    }

    public void delete(T entity) {
        dao.delete(entity);
    }

    public void update(T entity) {
        dao.update(entity);
    }

    public T get(T entity) {
        return dao.get(entity);
    }


}
